import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import "@/styles/index.scss";
import ElementPlus from "element-plus";
import "element-plus/theme-chalk/index.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import axios from "axios";
import VueAxios from "vue-axios";
import { createPinia } from "pinia"; // 导入createPinia函数
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import * as echarts from 'echarts';

const app = createApp(App);
const pinia = createPinia(); // 创建Pinia实例
// 注册ElementPlus图标组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

// 使用ElementPlus和Pinia
app.use(ElementPlus);
app.use(pinia);
pinia.use(piniaPluginPersistedstate);
app.use(router);
app.use(VueAxios, axios);
app.use(echarts);
app.mount("#app");
axios.defaults.baseURL = '/api'
